<template>
  <router-link :to="{path: '/yuwen', query: {id: 10}}">语文</router-link>
  <router-link :to="{name: 'shuxue', state: {id: 100}}">数学</router-link>

  <router-view/>


  <button @click="addShuXue">数学</button>
  <button @click="addYuwen">语文</button>

  <button>1</button>
  <button @click="addAge">age++</button>
  <p>{{age}}</p>
</template>


<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { User } from './pinia/store';
import { storeToRefs } from 'pinia';

const store = User()
const { addAge } = store
const { age } = storeToRefs(store)

const router = useRouter()

const addShuXue = () => {
  router.push({name: 'shuxue', state:{ title: 'ABC' }})
}
const addYuwen = () => {
  router.push({path: 'yuwen', query: {id: 123}})
}






</script>


